package yx.action;

import java.util.List;

import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.springframework.beans.factory.annotation.Autowired;

import yx.model.SmSms;
import yx.service.SmsServiceInt;
import yx.vo.DatagridVO;
import yx.vo.JsonVO;

import com.opensymphony.xwork2.ModelDriven;

@ParentPackage("basePackage")
@Namespace("/")
@Action(value = "smsAction")
public class SmsAction extends BaseAction implements ModelDriven<SmSms> {
	/**
	 * Logger for this class
	 */
	private static final Logger logger = Logger.getLogger(SmsAction.class);

	private SmSms sms = new SmSms();

	@Override
	public SmSms getModel() {
		return sms;
	}

	private SmsServiceInt smsService;

	public SmsServiceInt getSmsService() {
		return smsService;
	}

	@Autowired
	public void setSmsService(SmsServiceInt smsService) {
		this.smsService = smsService;
	}

	public void querySmsList() {
		DatagridVO datagridVO = smsService.datagrid();
		if(datagridVO.getTotal().intValue() != 0){
			List list = datagridVO.getRows();
			super.writeJson(list);
		}
	}


	public void editSms() {
	    smsService.edit(sms);
		JsonVO j = new JsonVO();
		j.setSuccess(true);
		j.setMsg("编辑成功！");
		j.setObj(sms);
		super.writeJson(j);
	}
	
	/**
	 * 查询余额
	 */
	public void queryAccount(){
	    
	}

}
